Page({
  data: {
    addressInfo:''
  },
  chooseAddress() {
    wx.chooseAddress({
      success: (res) => {
        console.log(res)
        let obj = JSON.stringify(res)
        wx.setStorage({
          key: 'address',
          data: obj,
        })
        this.setData({
          addressInfo: res
        })
        if(res){
          setTimeout(()=>{
            wx.navigateBack({
              data:1
            })
          },600)    
        }   
      },
      fail: function (err) {
        console.log(err11)
      }
    })
  },
  onLoad(){
    let t = this
    wx.setNavigationBarTitle({
      title:'收货地址',
    })
    let address = wx.getStorageSync('address')
   
    if (address){
     let addressInfo = JSON.parse(address)
     t.setData({
      addressInfo: addressInfo
    })
    }
  
    

  }
})
